﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using famails.iface;
using famails.dao;
using famails.dto;

namespace famails.bus
{
    /// <summary>
    /// Summary description for EventBUS
    /// </summary>
    public class EventBUS : IEvent
    {
        public EventBUS() { }

        #region IEvent Members
        EventDAO eDao = new EventDAO();
        public int tblEvent_insert(EventDTO dt)
        {
            return eDao.tblEvent_insert(dt);
        }

        public void tblEvent_Update(EventDTO dt)
        {
            eDao.tblEvent_Update(dt);
        }

        public void tblEvent_Delete(int EventId)
        {
            eDao.tblEvent_Delete(EventId);
        }

        public DataTable GetAll()
        {
            return eDao.GetAll();
        }

        public DataTable GetByID(int EventId)
        {
            return eDao.GetByID(EventId);
        }

        public DataTable GetAllListEvent(string subject, int userId, int group)
        {
            return eDao.GetAllListEvent(subject, userId, group);
        }

        public DataTable GetAllListEventDepart2(string subject, int Userid, int group)
        {
            return eDao.GetAllListEventDepart2(subject, Userid, group);
        }


        public System.Data.DataTable GetClientId(int userId)
        {
            return eDao.GetClientId(userId);
        }

        public DataTable GetAssignTo(int groupId)
        {
            return eDao.GetAssignTo(groupId);
        }


        public DataTable GetByUserId(int userId)
        {
            return eDao.GetByUserId(userId);
        }
        #endregion




        public void tblEventCustomer_Insert(int customerId, string eventId)
        {
            eDao.tblEventCustomer_Insert(customerId, eventId);
        }

        public void tblEventCustomer_Insert(EventDTO eventDto)
        {
            eDao.tblEventCustomer_Insert(eventDto);
        }

        internal DataTable Search(int userId, int groupid,  string subject, string from, string to)
        {
            return eDao.Search( userId,  groupid,   subject,  from,  to);
        }

        internal DataTable GetErrorMailList(decimal id, int Event1_SendRegister2)
        {
            return eDao.GetErrorMailList(id,Event1_SendRegister2);
        }
        public DataTable GetOpenMailByContentID(object ContentID)
        {
            return eDao.GetOpenMailByContentID(ContentID);
        }
    }
}